<template>
	<svg-icon :type='suffix' style="margin-right:8px"></svg-icon>
</template>
<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator';
import svgIcon from './svgIcon.vue';
@Component({
  components: { svgIcon },
  name: 'iconItem'
})
export default class extends Vue {
  @Prop({ default: '' }) private icon: any;
  private iconName = {
    png: 'iconfujian-PNG',
    jpg: 'iconfujian-JPG',
    jpeg: 'iconfujian-JPG',
    svg: 'iconfujian-SVG',
    gif: 'iconfujian-GIF',
    pdf: 'V7_iconV7tubiao_pdf',
    xlsx: 'V7_iconV7tubiao_xlsx',
    docx: 'V7_iconV7tubiao_doc',
    ppt: 'V7_iconV7tubiao_ppt',
    xls: 'V7_iconV7tubiao_xlsx'
  };

  private get suffix () {
    const str: any = /[^\\.]\w*$/.exec(this.icon.fileName)
    const suffix = str[0];
    return this.iconName[suffix] || 'iconfujian-wufashibie';
  }
}
</script>
<style lang="stylus" scoped></style>
